package cate.game.activity.Foodgod.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.Foodgod.FoodGodActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBFoodGod;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "福神降临领取奖励的请求")
@OperationSetter(GDOperation.FOOD_GOD_REWARD)
public class FoodGodGetRewardReq implements MsgInput {
    @NoteField("奖励tid")
    public int tid;

    @NoteField("功能ID")
    public int funcId;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        FoodGodActivity activity = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (activity == null) {
            game.notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<Void> r = activity.getReward(tid);
        game.notice.message(cc.getRole(), r, true);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBFoodGod.GET_REWARD_REQ;
    }
}
